<template>
  <div>
    <hr />
    <h1>Home：{{ $store.state.counter }}</h1>
    <button @click="addOne">+1</button>
    <button @click="reduceOne">-1</button>
  </div>
</template>
<script>
export default {
  mounted() {
    //事件派发
    this.$store.dispatch("getHomeBanner");
  },
  methods: {
    addOne() {
      this.$store.dispatch("incrementAction");
    },
    reduceOne() {
      // this.$store.dispatch("decrementAction");
      this.$store.dispatch({
        //另一种派发风格
        type: "decrementAction",
      });
    },
  },
};
</script>
<style>
</style>
